{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# GaN/Fe" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## import & prepare" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Defaulting to user installation because normal site-packages is not writeable\n", "Collecting git+https://github.com/nmdl-mizo/interface_master.git@develop\n", " Cloning https://github.com/nmdl-mizo/interface_master.git (to revision develop) to /tmp/pip-req-build-pi2px8wp\n", " Running command git clone --filter=blob:none --quiet https://github.com/nmdl-mizo/interface_master.git /tmp/pip-req-build-pi2px8wp\n", " Resolved https://github.com/nmdl-mizo/interface_master.git to commit 2bdf96ed4835b036557ac18de82b4fa2afdabf24\n", " Preparing metadata (setup.py) ... \u001b[?25ldone\n", "\u001b[?25hRequirement already satisfied: pymatgen in /home/vscode/.local/lib/python3.10/site-packages (from interfacemaster==1.1.1) (2023.1.30)\n", "Requirement already satisfied: matplotlib in /home/vscode/.local/lib/python3.10/site-packages (from interfacemaster==1.1.1) (3.7.0)\n", "Requirement already satisfied: gb_code in /home/vscode/.local/lib/python3.10/site-packages (from interfacemaster==1.1.1) (1.0.0)\n", "Requirement already satisfied: numpy>=1.14.0 in /home/vscode/.local/lib/python3.10/site-packages (from gb_code->interfacemaster==1.1.1) (1.24.2)\n", "Requirement already satisfied: python-dateutil>=2.7 in /usr/local/lib/python3.10/site-packages (from matplotlib->interfacemaster==1.1.1) (2.8.2)\n", "Requirement already satisfied: pillow>=6.2.0 in /home/vscode/.local/lib/python3.10/site-packages (from matplotlib->interfacemaster==1.1.1) (9.4.0)\n", "Requirement already satisfied: cycler>=0.10 in /home/vscode/.local/lib/python3.10/site-packages (from matplotlib->interfacemaster==1.1.1) (0.11.0)\n", "Requirement already satisfied: fonttools>=4.22.0 in /home/vscode/.local/lib/python3.10/site-packages (from matplotlib->interfacemaster==1.1.1) (4.38.0)\n", "Requirement already satisfied: pyparsing>=2.3.1 in /home/vscode/.local/lib/python3.10/site-packages (from matplotlib->interfacemaster==1.1.1) (3.0.9)\n", "Requirement already satisfied: contourpy>=1.0.1 in /home/vscode/.local/lib/python3.10/site-packages (from matplotlib->interfacemaster==1.1.1) (1.0.7)\n", "Requirement already satisfied: packaging>=20.0 in /usr/local/lib/python3.10/site-packages (from matplotlib->interfacemaster==1.1.1) (23.0)\n", "Requirement already satisfied: kiwisolver>=1.0.1 in /home/vscode/.local/lib/python3.10/site-packages (from matplotlib->interfacemaster==1.1.1) (1.4.4)\n", "Requirement already satisfied: networkx>=2.2 in /home/vscode/.local/lib/python3.10/site-packages (from pymatgen->interfacemaster==1.1.1) (3.0)\n", "Requirement already satisfied: tqdm in /home/vscode/.local/lib/python3.10/site-packages (from pymatgen->interfacemaster==1.1.1) (4.64.1)\n", "Requirement already satisfied: scipy>=1.5.0 in /home/vscode/.local/lib/python3.10/site-packages (from pymatgen->interfacemaster==1.1.1) (1.10.1)\n", "Requirement already satisfied: requests in /usr/local/lib/python3.10/site-packages (from pymatgen->interfacemaster==1.1.1) (2.28.2)\n", "Requirement already satisfied: monty>=3.0.2 in /home/vscode/.local/lib/python3.10/site-packages (from pymatgen->interfacemaster==1.1.1) (2022.9.9)\n", "Requirement already satisfied: pandas in /home/vscode/.local/lib/python3.10/site-packages (from pymatgen->interfacemaster==1.1.1) (1.5.3)\n", "Requirement already satisfied: pybtex in /home/vscode/.local/lib/python3.10/site-packages (from pymatgen->interfacemaster==1.1.1) (0.24.0)\n", "Requirement already satisfied: uncertainties>=3.1.4 in /home/vscode/.local/lib/python3.10/site-packages (from pymatgen->interfacemaster==1.1.1) (3.1.7)\n", "Requirement already satisfied: ruamel.yaml>=0.17.0 in /home/vscode/.local/lib/python3.10/site-packages (from pymatgen->interfacemaster==1.1.1) (0.17.21)\n", "Requirement already satisfied: palettable>=3.1.1 in /home/vscode/.local/lib/python3.10/site-packages (from pymatgen->interfacemaster==1.1.1) (3.3.0)\n", "Requirement already satisfied: mp-api>=0.27.3 in /home/vscode/.local/lib/python3.10/site-packages (from pymatgen->interfacemaster==1.1.1) (0.30.10)\n", "Requirement already satisfied: spglib>=2.0.2 in /home/vscode/.local/lib/python3.10/site-packages (from pymatgen->interfacemaster==1.1.1) (2.0.2)\n", "Requirement already satisfied: tabulate in /home/vscode/.local/lib/python3.10/site-packages (from pymatgen->interfacemaster==1.1.1) (0.9.0)\n", "Requirement already satisfied: sympy in /home/vscode/.local/lib/python3.10/site-packages (from pymatgen->interfacemaster==1.1.1) (1.11.1)\n", "Requirement already satisfied: plotly>=4.5.0 in /home/vscode/.local/lib/python3.10/site-packages (from pymatgen->interfacemaster==1.1.1) (5.13.0)\n", "Requirement already satisfied: setuptools in /usr/local/lib/python3.10/site-packages (from mp-api>=0.27.3->pymatgen->interfacemaster==1.1.1) (65.5.1)\n", "Requirement already satisfied: msgpack in /home/vscode/.local/lib/python3.10/site-packages (from mp-api>=0.27.3->pymatgen->interfacemaster==1.1.1) (1.0.4)\n", "Requirement already satisfied: typing-extensions>=3.7.4.1 in /home/vscode/.local/lib/python3.10/site-packages (from mp-api>=0.27.3->pymatgen->interfacemaster==1.1.1) (4.5.0)\n", "Requirement already satisfied: emmet-core>=0.39.8 in /home/vscode/.local/lib/python3.10/site-packages (from mp-api>=0.27.3->pymatgen->interfacemaster==1.1.1) (0.44.0)\n", "Requirement already satisfied: tenacity>=6.2.0 in /home/vscode/.local/lib/python3.10/site-packages (from plotly>=4.5.0->pymatgen->interfacemaster==1.1.1) (8.2.1)\n", "Requirement already satisfied: six>=1.5 in /usr/local/lib/python3.10/site-packages (from python-dateutil>=2.7->matplotlib->interfacemaster==1.1.1) (1.16.0)\n", "Requirement already satisfied: charset-normalizer<4,>=2 in /usr/local/lib/python3.10/site-packages (from requests->pymatgen->interfacemaster==1.1.1) (3.0.1)\n", "Requirement already satisfied: idna<4,>=2.5 in /usr/local/lib/python3.10/site-packages (from requests->pymatgen->interfacemaster==1.1.1) (3.4)\n", "Requirement already satisfied: urllib3<1.27,>=1.21.1 in /usr/local/lib/python3.10/site-packages (from requests->pymatgen->interfacemaster==1.1.1) (1.26.14)\n", "Requirement already satisfied: certifi>=2017.4.17 in /usr/local/lib/python3.10/site-packages (from requests->pymatgen->interfacemaster==1.1.1) (2022.12.7)\n", "Requirement already satisfied: ruamel.yaml.clib>=0.2.6 in /home/vscode/.local/lib/python3.10/site-packages (from ruamel.yaml>=0.17.0->pymatgen->interfacemaster==1.1.1) (0.2.7)\n", "Requirement already satisfied: future in /home/vscode/.local/lib/python3.10/site-packages (from uncertainties>=3.1.4->pymatgen->interfacemaster==1.1.1) (0.18.3)\n", "Requirement already satisfied: pytz>=2020.1 in /usr/local/lib/python3.10/site-packages (from pandas->pymatgen->interfacemaster==1.1.1) (2022.7.1)\n", "Requirement already satisfied: latexcodec>=1.0.4 in /home/vscode/.local/lib/python3.10/site-packages (from pybtex->pymatgen->interfacemaster==1.1.1) (2.0.1)\n", "Requirement already satisfied: PyYAML>=3.01 in /usr/local/lib/python3.10/site-packages (from pybtex->pymatgen->interfacemaster==1.1.1) (6.0)\n", "Requirement already satisfied: mpmath>=0.19 in /home/vscode/.local/lib/python3.10/site-packages (from sympy->pymatgen->interfacemaster==1.1.1) (1.2.1)\n", "Requirement already satisfied: pydantic>=1.10.2 in /home/vscode/.local/lib/python3.10/site-packages (from emmet-core>=0.39.8->mp-api>=0.27.3->pymatgen->interfacemaster==1.1.1) (1.10.5)\n", "\n", "\u001b[1m[\u001b[0m\u001b[34;49mnotice\u001b[0m\u001b[1;39;49m]\u001b[0m\u001b[39;49m A new release of pip available: \u001b[0m\u001b[31;49m22.3.1\u001b[0m\u001b[39;49m -> \u001b[0m\u001b[32;49m23.0.1\u001b[0m\n", "\u001b[1m[\u001b[0m\u001b[34;49mnotice\u001b[0m\u001b[1;39;49m]\u001b[0m\u001b[39;49m To update, run: \u001b[0m\u001b[32;49mpip install --upgrade pip\u001b[0m\n", " % Total % Received % Xferd Average Speed Time Time Time Current\n", " Dload Upload Total Spent Left Speed\n", "100 951 100 951 0 0 2926 0 --:--:-- --:--:-- --:--:-- 2935\n" ] } ], "source": [ "!pip install git+https://github.com/nmdl-mizo/interface_master.git@develop\n", "!mkdir -p cif_files\n", "!curl https://raw.githubusercontent.com/nmdl-mizo/interface_master/develop/test_files/cif_files/GaN_mp-804_conventional_standard.cif -o 'cif_files/GaN_mp-804_conventional_standard.cif'\n", "!curl https://raw.githubusercontent.com/nmdl-mizo/interface_master/develop/test_files/cif_files/Fe_mp-13_conventional_standard.cif -o 'cif_files/Fe_mp-13_conventional_standard.cif'" ] }, { "cell_type": "code", "execution_count": 1, "metadata": {}, "outputs": [], "source": [ "from interfacemaster.cellcalc import get_primitive_hkl, get_pri_vec_inplane, get_normal_index, get_normal_from_MI, rot\n", "from interfacemaster.interface_generator import core, convert_vector_index, get_disorientation\n", "from numpy import array, dot, round, cross, eye\n", "from numpy.linalg import inv, det, norm" ] }, { "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ "## Define an interface core class" ] }, { "cell_type": "code", "execution_count": 10, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Warning!, this programme will rewrite the POSCAR file in this dir!\n" ] } ], "source": [ "my_interface = core('cif_files/GaN_mp-804_conventional_standard.cif',\\\n", " 'cif_files/Fe_mp-13_conventional_standard.cif')" ] }, { "cell_type": "code", "execution_count": 11, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "array([[ 3.21633760e-01, 5.00000000e-01, 8.04084401e-01],\n", " [-1.85695338e-01, 8.66025404e-01, -4.64238345e-01],\n", " [-9.28476691e-01, 4.28707594e-17, 3.71390676e-01]])" ] }, "execution_count": 11, "metadata": {}, "output_type": "execute_result" } ], "source": [ "#target disorientation\n", "R = get_disorientation(L1 = my_interface.conv_lattice_1, L2 = my_interface.conv_lattice_2, \\\n", " v1 = [-1,-1,0], hkl1 = [1, -1, 0], \\\n", " v2 = [0,-1,0], hkl2 = [2, 0, 5])\n", "R" ] }, { "cell_type": "code", "execution_count": 12, "metadata": {}, "outputs": [], "source": [ "#combining two specified surfaces\n", "hkl_1 = get_primitive_hkl([1, -1, 0], my_interface.conv_lattice_1, my_interface.lattice_1)\n", "hkl_2 = get_primitive_hkl([2, 0, 5], my_interface.conv_lattice_2, my_interface.lattice_2)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Searching two_dimensional CSL" ] }, { "cell_type": "code", "execution_count": 13, "metadata": { "scrolled": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Congrates, we found an appx CSL!\n", "\n", "U1 = \n", "[[4 0]\n", " [0 0]\n", " [0 3]]; sigma_1 = 12\n", "\n", "U2 = \n", "[[-5 5]\n", " [ 0 7]\n", " [-5 2]]; sigma_2 = 52\n", "\n", "D = \n", "[[ 0.97649518 -0.04071154 0. ]\n", " [-0.04071154 0.92948554 0. ]\n", " [-0. -0. 1.02783677]]\n", "\n", "axis = [14.59533203 -8.42661887 0. ] ; theta = 0.0\n", "\n" ] } ], "source": [ "my_interface.parse_limit(du = 1e-1, S = 1e-1, sgm1=200, sgm2=200, dd = 1e-1)\n", "\n", "#Do searching!\n", "my_interface.search_one_position_2D(hkl_1, hkl_2, theta_range = 1, \\\n", " dtheta = 0.01, pre_R=R, pre_dt= True, integer_tol = 1e-4)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Get bicrystal" ] }, { "cell_type": "code", "execution_count": 14, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "cell 1:\n", "[[-1 4 0]\n", " [-2 0 0]\n", " [ 0 0 3]]\n", "cell 2:\n", "[[ 1 -5 5]\n", " [-1 0 7]\n", " [-2 -5 2]]\n" ] } ], "source": [ "my_interface.compute_bicrystal_two_D(hkl_1 = hkl_1, hkl_2=hkl_2, normal_ortho = True, lim = 50, tol_ortho = 1e-2, tol_integer=1e-3)" ] }, { "cell_type": "code", "execution_count": 15, "metadata": {}, "outputs": [], "source": [ "my_interface.get_bicrystal(two_D = True, xyz_1 = [1,1,1], xyz_2 = [1,1,1])" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Please check the POSCAR file" ] } ], "metadata": { "kernelspec": { "display_name": "Python 3", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.10.9" }, "vscode": { "interpreter": { "hash": "949777d72b0d2535278d3dc13498b2535136f6dfe0678499012e853ee9abcab1" } } }, "nbformat": 4, "nbformat_minor": 4 }